package com.zsjt.basic.find;

/**
 * @author zhanb
 * @Date 2020/5/20
 */
public class LinearSearch {

    public static void main(String[] args) {
        int[] arr ={1,9,123,123413,341231,45131,4543143};
        System.out.println(search(arr, 9));
    }

    /**
     *
     * @param array
     * @param value
     * @return
     */
    public static  int  search(int[] array, int value){
        for (int i =0  ;i <array.length ;i++) {
            if(array[i] == value) {
                return i;
            }
        }
        return -1;
    }
}
